package com.example.vertify;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

import com.example.getcode.R;
import com.revo.aesrsa.JniUtil;
import com.tamsiree.rxfeature.activity.ActivityScanerCode;
import com.tamsiree.rxfeature.scaner.OnRxScanerListener;

/**
 * <p>Author：     zenglq<p>
 * <p>Email：      380233376@qq.com<p>
 * <p>Date：       2025/10/22<p>
 * <p>Description：<p>
 */
public class TestActivity extends Activity {



    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btnActive).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityScanerCode.Companion.setScanerListener(new OnRxScanerListener() {
                    @Override
                    public void onSuccess(@Nullable String s, @Nullable com.google.zxing.Result result) {
                        App.ActivityTracker.INSTANCE.finishActivity(ActivityScanerCode.class);
                        String code = JniUtil.getActiveCode(s);
                        Log.d("zlq" ,"code = " + code);
                        ((AppCompatTextView)findViewById(R.id.tv_code)).setText(code);
                    }

                    @Override
                    public void onFail(@Nullable String s, @Nullable String s1) {

                    }
                });
                startActivity(new Intent(TestActivity.this, ActivityScanerCode.class));
            }
        });
    }
}
